<template>
  <template v-for="(item) in menuList">
    <el-sub-menu :index="item.path" v-if="item.type === 1">
      <template #title>
        <el-icon v-if="item.icon"><component :is="item.icon"/></el-icon>
        <span>{{ item.menuName }}</span>
      </template>
      <tp-menu :menuList="item.children"></tp-menu>
    </el-sub-menu>
    <el-menu-item :index="item.path" v-if="item.type === 0">
      <el-icon v-if="item.icon"><component :is="item.icon"/></el-icon>
      <template #title>{{ item.menuName }}</template>
    </el-menu-item>
  </template>
</template>

<script lang="ts" setup>
import { MenuData } from '../../data/MenuData'

// 定义组件参数
defineProps<{
  menuList?: MenuData[]
}>()
</script>